﻿#pragma once
#include"FSMItem.h"
#include <vector>

class FSM
{
public:
    //默认有参构造函数  初始状态为GETUP
    FSM(FSMItem::State curState = FSMItem::GETUP):_curState(curState)
    {
        initFSMTable();
    }

    //状态转移
    void transferState(FSMItem::State nextState);

    //根据当前的状态和发生的时间，执行相应的动作，并进行状态转移
    void handleEvent(FSMItem::Events event);

private:
    void initFSMTable();

public:
    FSMItem::State _curState; //现态

private:
    vector<FSMItem*> _fsmTable;  //状态转移表
    
};